package cn.flyme.shop.controller;

import cn.flyme.shop.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class CustomerController {
    @Autowired
    private CustomerService customerService;

    /**
     * 登录
     * @param name
     * @param passwd
     * @param code
     * @return
     */
    @RequestMapping("/doLogin")
    public String login(String name,String passwd,String code){
        //直接把customer放入session
        return "redirect:/index";
    }

    /**
     * 注册
     * @param name
     * @param passwd
     * @param email
     * @param code
     * @return
     */
    @RequestMapping("doRegister")
    public String register(String name,String passwd,String email,String code){
        return "redirect:/login";
    }

    /**
     * 修改收货地址
     * @param address 新地址
     * @return
     */
    @RequestMapping("/customer/editAddress")
    @ResponseBody
    public String editAddress(String address){
        return "修改成功";
    }

    /**
     * 修改个人信息
     * @return
     */
    @RequestMapping("/customer/save")
    @ResponseBody
    public String save(String name,String email, String tel,String cur_pass,String new_pass,String conf_new_pass){
        System.out.println(name+email);
        return "修改成功";
    }

}
